<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Logger extends MY_Controller {

	function __construct()
    {
		// Call the Model constructor
        parent::__construct();
		if($this->session->userdata('login') === TRUE && in_array(110,$this->access)){

		}else{
			redirect('sessions/login');
		}
    }
	
	public function index()
	{
		$this->load->model('model_log');
		
		//setting option
		$date_a = date("Y").'-'.date('m').'-01';
		$date_b = date("Y-m-d");
		$page = 1;
		$limit = 20;
		$q = '';
		$custom='';
		// $reg = $this->session->userdata('reg');
		// if($reg > 0)
			// $custom="activity='ISSUED'";
			
		if(isset($_POST['page'])){
			$page = $_POST['page'];
			$date_a = $_POST['date_a'];
			$date_b = $_POST['date_b'];
			$q = $_POST['q'];
		}
		
		$data['log']= $this->model_log->get_log($date_a,$date_b,($page-1),$limit,$q,$custom);
		$data['date_a'] = $date_a;
		$data['date_b'] = $date_b;
		$data['q'] = $q;
		$data['page'] = $page;
		$data['limit'] = $limit;

		$params['content']= $this->load->view('list',$data,TRUE);
		$params['footer']['js_plugin'] = $this->load->view('js_plugin','',TRUE);
		$params['footer']['js_init'] = $this->load->view('js_list_init','',TRUE);
		$params['header']['css_plugin'] = $this->load->view('css_plugin','',TRUE);
		
		echo modules::run('template', $params);	
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */